package com.biz.common;

import com.biz.bean.*;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 *
 *  自定义客户端返回格式
 *  捕获客户端返回异常
 * @Author liuxi
 * @Date 2024/4/20
 **/
@RestControllerAdvice
public class ExceptionAdaptController {

    /**
     * 异常拦截 拦截所有运行时异常
     *
     * @param exception
     * @return
     */
    @ExceptionHandler({RuntimeException.class})
    public Result runTimeException (RuntimeException exception) {
        exception.printStackTrace();
        return Result.fail();
    }
}
